{%- macro extends(class) -%}
{%- if class['inherits'] -%}
 extends {{class['inherits']}}
{%- endif -%}
{%- endmacro -%}

{%- for den in dependency %}
{%- if den != class['name']%}
import { {{den}} } from "@godot/classes/{{camel_to_snake(den)}}";
{%- endif %}
{%- endfor %}

declare global {
export declare class {{class['name']}} {{extends(class)}}{
  {%- for ctr in class['constructors']%}
  constructor({{connect_args(ctr['arguments'])}});
  {%- endfor %}

  {%- for member in class['members'] %}
  public {{member['name']}}: {{member['type']}};
  {%- endfor %}
  {%- for method in class['methods'] %}
  public {{method['name']}}({{connect_args(method['arguments'])}}){{set_return(method['return_type'] if method['return_type'] else None)}};
  {%- endfor %}
  
  {%- for enum in class['enums'] %}
  static {{enum['name']}} = {
    {%- for value in enum['values'] %}
    {{value['name']}} = {{value['value']}},
    {%- endfor %}
  }
  {%- endfor %}
}
}

export {};